package principle.dependecy.inversion;

public class InterfaceDependency {
    private Person person = new Person();


    public static void main(String[] args) {
        InterfaceDependency interfaceDependency = new InterfaceDependency();
        interfaceDependency.start();
    }

    private void start() {
        person.reciver(new Email());
        person.reciver(new WX());
    }

}


class Person {

    /**
     * 接收消息
     *
     * @param reciver
     */
    public void reciver(IReciver reciver) {
        reciver.recive();
    }

}


interface IReciver {
    void recive();
}

class Email implements IReciver {

    @Override
    public void recive() {
        System.out.println("接收Email文件");
    }
}

class WX implements IReciver {

    @Override
    public void recive() {
        System.out.println("接收WX文件");
    }
}